﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminSite.Master"
    Inherits="System.Web.Mvc.ViewPage<IEnumerable<HYBYSoft.Company.Models.QuestionMessage>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Index
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#StartTime").attr("readonly", "true").datepicker({ dateFormat: 'yy-mm-dd',
                dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
            });

            $("#EndTime").attr("readonly", "true").datepicker({ dateFormat: 'yy-mm-dd',
                dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
                dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
            });
        });
    </script>
    <div id="content">
        <div id="div_search">
            <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tr>
                    <td id="left_search">
                    </td>
                    <td id="bg_search">
                        <p>
                            <span id="sitemap">当前位置：</span>
                        </p>
                        <%using (Html.BeginForm("Search", "QuestionMessages"))
                          {%>
                        <p>
                            问题：<%=Html.TextBox("Titles", null, new { style = "width:110px;margin-right:15px" })%>起始时间：<%=Html.TextBox("StartTime", null, new { style = "width:110px;margin-right:15px" })%>截止时间：<%=Html.TextBox("EndTime", null, new { style = "width:110px;margin-right:15px" })%>状态：<%=Html.DropDownList("IsDelete", new SelectListItem[] { new SelectListItem { Text = "全部", Value = "2" }, new SelectListItem { Text = "已删除", Value = "0" }, new SelectListItem { Text = "未删除", Value = "1" } }, new { style = "width:110px;margin-right:15px" })%><input
                                type="submit" value="查询" />
                        </p>
                        <%} %>
                    </td>
                    <td id="right_search">
                    </td>
                </tr>
            </table>
        </div>
        <div id="div_list">
            <%if (Model.Count() == 0)
              {
                  Html.RenderPartial("partialNoneDate");
              }
              else
              {
                  var grid = new WebGrid(source: Model, defaultSort: "CreateTime", rowsPerPage: 10, canSort: false);%>
            <%=grid.GetHtml(tableStyle:"grid",headerStyle:"header",footerStyle:"footer",rowStyle:"row",alternatingRowStyle:"alt",
                 mode:WebGridPagerModes.All,firstText:"首页",previousText:"上一页",nextText:"下一页",lastText:"末页",
                              columns: new WebGridColumn[]{new WebGridColumn{ Header="内容", Format=(item)=>Html.ActionLink(((string)item.Titles).Length>20?(string)item.Titles.Substring(0,22)+"...":(string)item.Titles,"Details",new {id=item.QuestionID} ),Style="titlecolumn a"},
                                                           new WebGridColumn{ Header ="创建时间", ColumnName="CreateTime", Style="datecolumn"},
                                                           new WebGridColumn{ Header="回复时间",ColumnName="LastReplyTime",Style="datecolumn"},
                                                           new WebGridColumn{ Header="已删除",Format=(item)=>item.State==0?"是":"否"},
                                                           new WebGridColumn{ Header="删除",Format=(item)=>Html.ActionLink(item.State==0?" ":"删除","Delete",new {id=item.QuestionID},new {onclick="return confirm('确定要删除？');"}),Style="buttoncolumn"},
                                                           new WebGridColumn{ Header="回复",Format=(item)=>Html.ActionLink(item.State==0?" ":"回复","Reply",new{id=item.QuestionID},new { style ="buttoncolumn"})}})%>
            <%} %>
        </div>
    </div>
</asp:Content>
